/* 
 * DoctorHashTest.java
 *
 * This program demonstrates the tests the usage of a HashMap to store
 * the different Doctor objects.
 *
 * Copyright � 2007 Aptech Software Limited. All Rights Reserved.
 */


import java.util.Scanner;

/**
 * This program tests the use of DoctorHash class.
 * @author vincent
 */
public class DoctorHashTest {
  
  /** Creates a new instance of DoctorHashTest */
  public DoctorHashTest() {
  }
  
  /**
   * This is the entry point of the application.
   * @param args the command line arguments
   */
  public static void main(String[] args) {
    
    // Create an instance of DoctorHash class
    DoctorHash<String,DoctorDetails> doctorHashObj = new DoctorHash<String,DoctorDetails>();
    DoctorDetails dd;
    
    // Declare variable to store the option selected by the user
    int choice;
    
    // Accept user data
    Scanner input = new Scanner(System.in);
    
    // Iterate until the user chooses to exit
    do {
      System.out.println("\n!!!Welcome to LifeLine Hospital!!!\n" +
          "\nSelect the operation you want to perform:");
      System.out.println("******************************************");
      
      System.out.println("1. Register Doctor");
      System.out.println("2. Display the Doctor details");
      System.out.println("3. Publish the entire list");
      System.out.println("4. Exit");
      System.out.println("******************************************");
      
      choice = input.nextInt();
      
      // Invoke various methods depending on the operation
      // selected by the user
      switch(choice) {
        case 1:
          dd = doctorHashObj.add();
          doctorHashObj.DoctorHashMap.put(dd.docCode, dd);
          break;
        case 2:
          doctorHashObj.display();
          System.out.println("Press any key to continue");
          String a = input.next();
          break;
        case 3:
          doctorHashObj.publish();
           System.out.println("Press any key to continue");
          String b = input.next();
          break;
        case 4:
          break;
        default:
          System.out.println("Not a valid choice!!!");
      }
    } while(choice != 4);
  }
  
}
